<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>访问节点</title>
    <link rel="stylesheet" href="css/newStyle.css">
</head>
<body>
<section id="news">
    <header>京东头条<a href="#">更多 > </a></header>
    <ul>
        <li><a href="#">鼠标满300减30</a></li><li><a href="#">京东生鲜极速达</a></li><li><a href="#">99元抢平板！品牌秒杀</a></li><li><a href="#">格力节能领跑京东优惠购物节</a></li><li><a href="#">苏泊尔电器大促满199-100</a></li>
    </ul>
</section>
<script>
//     var obj=document.getElementById("news");
// var str=obj.lastChild.firstChild.nextSibling.nextSibling.innerHTML;
// alert(str);

// var obj=document.getElementById("news");
// alert(obj.lastChild.childNodes.length);

var obj=document.getElementById("news");
var str=obj.lastChild;
var str2=obj.lastElementChild;   // Element 可以屏蔽文本节点
console.log(str);
console.log(str2);


    // var obj=document.getElementById("news");
    // var str=obj.lastChild.firstChild.nextSibling.nextSibling.innerHTML;
    // ////var str=obj.lastChild.lastChild.previousSibling.previousSibling.innerHTML;
    // var str=obj.lastElementChild.firstElementChild.innerHTML||obj.lastChild.firstChild.innerHTML;
    // alert(str);
</script>
</body>
</html>